from src.impl.output import get_output_float16, get_output_float32
from src.generator_utils import get_random_seed_tensor
import time

# group = [('bias_add', (1, 28, 28, 1)), ('conv2d', (1, 1, 28, 28)), ('batch_normalization', (4, 3, 14, 14)),
#          ('avg_pool', (1, 32, 14, 14)), ('max_pool', (1, 32, 14, 14)), ('relu', (1, 32, 14, 14)),
#          ('sigmoid', (1, 20)), ('softmax', (1, 100)), ('tanh', (1, 20)),
#          ('dense', (1, 256)), ('reduce_mean', (16, 30)), ('reduce_max', (16, 30))]
# dic_32 = {}
# dic_16 = {}
#
# for op, shape in group:
#     print(op)
#     total_32 = 0
#     total_16 = 0
#     for t in range(1000):
#         tensor = get_random_seed_tensor(shape)
#         time_32 = time.time()
#         tf_output, torch_output, mnn_output, variable = get_output_float32(tensor, op)
#         time_32 = time.time() - time_32
#         total_32 += time_32
#         time_16 = time.time()
#         tf_output, torch_output, mnn_output, _ = get_output_float16(tensor, op, variable)
#         time_16 = time.time() - time_16
#         total_16 += time_16
#     total_32 /= 3000
#     total_16 /= 3000
#     dic_32[op] = total_32
#     dic_16[op] = total_16
# print(dic_32)
# print(dic_16)
